package org.codert.web;

import org.codert.service.FeignGoodsService;
import org.codert.service.NativeGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: TanJingyu
 * @create: 2021-09-21 20:46
 **/
@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private NativeGoodsService nativeGoodsService;
    @Autowired
    private FeignGoodsService feignGoodsService;

    @GetMapping("/native")
    public String nativeGoods() {
        try {
            return nativeGoodsService.listGoods();
        } catch (InterruptedException e) {
            return "出错了";
        }
    }

    @GetMapping("/feign")
    public String feignGoods() {
        return feignGoodsService.listGoods("王吉");
    }
}
